import React from 'react';
import { Button } from 'antd';

class CustomButtonEdit extends React.PureComponent {
	onClick = () => {
		const { btn, onRightMenuClick } = this.props;
		if (btn.type === 'BTN_ACC_EDIT') {
			window.openFullWindowForXtable(`/spa/document/index2file.jsp?${btn.params}${window.__moudleParams}#/main/document/fileView`);
		} else if (typeof onRightMenuClick === 'function') {
			onRightMenuClick(btn.type);
		}
	}
  render() {
		const { btn, ecId } = this.props;
    return (
			<Button ecId={ecId}
			type="primary"
			onClick={this.onClick}
			>{btn.menuName}</Button>
    );
  }
}

export default CustomButtonEdit;
